@tool
extends CollisionPolygon2D


class_name VisualRectCollision2D
"""
视野范围矩形碰撞区域
"""


@export var rect_size: Vector2 = Vector2.ZERO


func _ready() -> void:
    var points: PackedVector2Array = PackedVector2Array()
    var draw_rect_size: Vector2 = rect_size
    if rect_size.is_zero_approx():
        draw_rect_size = get_viewport().get_visible_rect().size / 2
    ShapeDraw.get_rect_arc_points(points, draw_rect_size, 0, TAU)
    polygon = points
